#ifndef CLIENTHANDLE_H
#define CLIENTHANDLE_H

#include <QObject>
#include <QTcpSocket>

class QNetworkSession;

class ClientHandle : public QObject
{
	Q_OBJECT

	QTcpSocket* _socket;

	QNetworkSession* _networkSession;

public:
	ClientHandle(QObject *parent = NULL);
	void setConnection(QString ip, int port);
	void sendData(QByteArray data);
	void disconnect();

protected slots:
	void onReadReady();
	void displayError(QAbstractSocket::SocketError socketError);
	void sessionOpened();
	void initSession();

signals:
	void incomming(QString data);
};

#endif // CLIENTHANDLE_H
